bitkeeper revision 1.1236.12.5 (422da8ab_AbA2_rC_i23sDg0BY_avQ)
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 8 Mar 2005 13:29:15 +0000 (13:29 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 8 Mar 2005 13:29:15 +0000 (13:29 +0000)
Time cleanup.
Signed-off-by: Keir Fraser <keir.fraser@cl.cam.ac.uk>
xen/arch/x86/time.c
xen/include/xen/sched.h

index 52a086a2398e99128a9232e7de162691188de2f7..0bd051954fc2ae7f14b45940b099018c33711fdf 100644 (file)
@@ -274,21 +274,13 @@ s_time_t get_s_time(void)
     return now; 
 }
 
-
-void update_dom_time(struct exec_domain *ed)
+static inline void __update_dom_time(struct exec_domain *ed)
 {
     struct domain *d  = ed->domain;
     shared_info_t *si = d->shared_info;
-    unsigned long flags;
 
-    if ( d->last_propagated_timestamp == full_tsc_irq )
-        return;
-
-    read_lock_irqsave(&time_lock, flags);
     spin_lock(&d->time_lock);
 
-    d->last_propagated_timestamp = full_tsc_irq;
-
     si->time_version1++;
     wmb();
 
@@ -302,11 +294,20 @@ void update_dom_time(struct exec_domain *ed)
     si->time_version2++;
 
     spin_unlock(&d->time_lock);
-    read_unlock_irqrestore(&time_lock, flags);
-
-    send_guest_virq(ed, VIRQ_TIMER);
 }
 
+void update_dom_time(struct exec_domain *ed)
+{
+    unsigned long flags;
+
+    if ( ed->domain->shared_info->tsc_timestamp != full_tsc_irq )
+    {
+        read_lock_irqsave(&time_lock, flags);
+        __update_dom_time(ed);
+        read_unlock_irqrestore(&time_lock, flags);
+        send_guest_virq(ed, VIRQ_TIMER);
+    }
+}
 
 /* Set clock to <secs,usecs> after 00:00:00 UTC, 1 January, 1970. */
 void do_settime(unsigned long secs, unsigned long usecs, u64 system_time_base)
@@ -328,11 +329,11 @@ void do_settime(unsigned long secs, unsigned long usecs, u64 system_time_base)
     wc_sec  = secs;
     wc_usec = _usecs;
 
-    write_unlock_irq(&time_lock);
-
     /* Others will pick up the change at the next tick. */
-    current->domain->last_propagated_timestamp = 0; /* force propagation */
-    update_dom_time(current);
+    __update_dom_time(current);
+    send_guest_virq(current, VIRQ_TIMER);
+
+    write_unlock_irq(&time_lock);
 }
 
 
index 061f17e50106fea37403ac39d6d850146f9479f4..83925b46f59337007e303d9e5fcd45b17ab145b0 100644 (file)
@@ -141,9 +141,6 @@ struct domain
     u16 pirq_to_evtchn[NR_PIRQS];
     u32 pirq_mask[NR_PIRQS/32];
 
-    /* Last point at which timestamp info was propagated to the guest. */
-    u64 last_propagated_timestamp;
-
     /* Physical I/O */
     spinlock_t       pcidev_lock;
     struct list_head pcidev_list;